<template>
  <div class="app-container">
    <el-row>
      <el-col :span="8" class="card-box">
        <el-card>
          <div class="el-table el-table--enable-row-hover el-table--medium">
            <table  style="width: 100%;">
              <thead>
              <tr>
                <td><div class="cell">患者姓名：
                  <el-input
                    size="mini"
                    placeholder="请输入内容"
                    v-model="his_patientbank.sName"
                    :disabled="false"
                    style="margin-right: 13px;width: 229px;margin-top:10px;margin-bottom: 10px;"

                  >
                  </el-input><i class="el-icon-user-solid" @click="open"></i></div>
                </td>
              </tr>
              </thead>
              <tbody>
              <tr>
                <td><div class="cell">身份证号：
                  <el-input
                    size="mini"
                  placeholder="请输入内容"
                  v-model="his_patientbank.sIdnumber"
                  :disabled="false"
                  style="margin-right: 0px;width: 250px;margin-top:10px;margin-bottom: 10px"

                >
                </el-input></div>
                </td>
              </tr>
              <tr>
                <td><div class="cell">患者电话：
                  <el-input
                    size="mini"
                    placeholder="请输入内容"
                    v-model="his_patientbank.sPhone"
                    :disabled="false"
                    styldisabled="true"e="margin-right: 0px;width: 250px;margin-top:10px;margin-bottom: 10px"

                  >
                  </el-input></div>
                </td>
              </tr>

              性别：<template>
                <el-radio v-model="radio" label="1">男</el-radio>
                <el-radio v-model="radio" label="2">女</el-radio>
                <el-radio v-model="radio" label="3">未知</el-radio>
              </template>


              <div class="block">
                <span class="demonstration">发病日期：</span>
                <el-date-picker
                  align="center"
                  size="mini"
                  v-model="his_patientbank.sDate"
                  type="date"
                  placeholder="选择日期"
                  style="margin-right: 0px;width: 250px;margin-bottom: 10px;margin-top: 10px">
                </el-date-picker>
              </div>



              <tr>
                <td>
                  患者年龄：<el-input v-model="his_patientbank.sAge" placeholder="请输入内容" size="mini" style="margin-right: 0px;width: 250px;margin-top:10px;margin-bottom: 10px" ></el-input>
                </td>
              </tr>

              <tr>
                <td>
                  <span class="demonstration">地址信息：</span><el-input
                    type="textarea"
                    :rows="2"
                    placeholder="请输入内容"
                    v-model="his_patientbank.sAddress"
                    style="margin-right: 0px;width: 250px;margin-top:10px;margin-bottom: 10px">
                  </el-input>
                </td>
              </tr>



              <tr>
                <td>
                  <span class="demonstration">过敏史：</span><el-input
                  type="textarea"
                  :rows="2"
                  placeholder="请输入内容"
                  v-model="his_patientbank.sAllergy"
                  style="margin-right: 0px;width: 250px;margin-top:10px;margin-bottom: 10px">
                </el-input>
                </td>
              </tr>


              </tbody>
            </table>
          </div>
        </el-card>
      </el-col>

      <el-col :span="16" class="card-box">
        <el-card>
          <table  style="width: 100%;">
            挂号单id:<span v-text="regnum.s_registration_form_id"></span>
            <br/>
            病例编号:<span v-text="regnum.s_case_number"></span>
            <tr style="margin-right: 0px">
              <td>
                <el-row>
<!--                  <span v-text="'有缺陷   应该动态的控制按钮是正常状态还是禁用状态'"></span>-->
                  <el-button
                    type="primary"
                    icon="el-icon-plus"
                    v-hasPermi="['visits:newvisits:saveprescription']"
                    @click="saveAllCase()"
                  >保存病例</el-button>
<!--                  <span v-text="'×同理  有点问题,查出来的id 和 实际要保存的id可能不一样 由于在处方和列表弹窗中可能删除数据导致保存的数据id不相同 在前台将ids数组进行删除  '"></span>-->
                  <!--先创建一个空数组  然后先获取用户点击删除的当前行的id传到调用的删除方法中  然后遍历集合 如果集合中的id和用户点 删除的id相同就不把当前id添加到空数组中 用户没点删除的就保存到ids数组中然后将要添加到中间表的ids传过去就好了-->
                  <el-button type="danger"
                  @click="reload()">就诊完成</el-button>
                </el-row>
              </td>
            </tr>
          </table>
        </el-card>
      </el-col>



      <el-col :span="16" class="card-box">


        <el-tabs type="border-card">
          <el-tab-pane label="病例">
            <el-card>
              <div class="el-table el-table--enable-row-hover el-table--medium">
                <table  style="width: 100%;">
                  <tbody>
                  <el-row :gutter="20">
                    <el-col :span="8"><div class="grid-content bg-purple">
                      <div class="block">
                        <span class="demonstration">发病日期：</span>
                        <el-date-picker
                          align="center"
                          size="mini"
                          v-model="his_patientbank.sDate"
                          type="date"
                          placeholder="选择日期"
                          style="margin-right: 0px;width: 175px;margin-bottom: 10px;margin-top: 10px">
                        </el-date-picker>
                      </div>
                    </div></el-col>
                    <el-col :span="8"><div class="grid-content bg-purple">
                      <template>
                        <span class="demonstration">接诊类型：</span>
                        <el-select v-model="jzlxoptions.dictLabel" placeholder="初诊"
                                   size="mini"
                                   style="margin-right: 0px;width: 175px;margin-bottom: 10px;margin-top: 10px">
                          <el-option
                            v-for="item in jzlxoptions"
                            :key="item.dictValue"
                            :label="item.dictLabel"
                            :value="item.dictValue"
                          >    <!--dictValue代表的是字典键值的意思  dictLabel代表的是字典标签的意思 -->
                          </el-option>
                        </el-select>
                      </template>
                    </div></el-col>
                    <el-col :span="8"><div class="grid-content bg-purple">
                      <template>
                        <span class="demonstration">是否传染：</span>
                        <el-select v-model="sfgroptionssfgroptions.dictLabel" placeholder="否"
                                   size="mini"
                                   style="margin-right: 0px;width: 175px;margin-bottom: 10px;margin-top: 10px">
                          <el-option
                            v-for="item in sfgroptions"
                            :key="item.dictValue"
                            :label="item.dictLabel"
                            :value="item.dictValue"
                          >
                          </el-option>
                        </el-select>
                      </template>
                    </div></el-col>
                  </el-row>



                  <!--写弹窗的地方-->

                  <el-dialog :title="title" :visible.sync="prescription" width="600px" append-to-body>
                    <el-table  :data="his_patientbanks" >  <!-- 这条相当于把返回的全部数据遍历输出 -->
                      <el-table-column label="患者姓名" prop="s_name" width="120" />
                      <el-table-column label="流水编号" prop="s_id" :show-overflow-tooltip="true" width="150" />
                      <el-table-column label="挂号类型" prop="s_registration" :show-overflow-tooltip="true" width="150" />
                      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
                        <template slot-scope="scope">
                          <el-button
                            size="mini"
                            type="text"
                            icon="el-icon-edit"
                            @click="preList(scope.row.s_id)"
                            v-hasPermi="['visits:newvisits:query']"
                          >接诊</el-button>
                        </template>
                      </el-table-column>
                    </el-table>
                  </el-dialog>


                  <el-dialog :title="title" :visible.sync="Openprescription"  style="width: 1500px;" append-to-body>
                    <el-button
                      size="mini"
                      type="primary"
                      icon="el-icon-plus"
                      @click="newvisits()"
                    >确定添加</el-button>
                    <span v-text="'检查处方全额为'+this.allPrice+'元'"></span>
                    <el-table  :data="findPrescriptionByID">  <!-- 这条相当于把返回的全部数据遍历输出 prop和集合中的实体类型对应上-->
                      <el-table-column label="序号" prop="a_id" />
                      <el-table-column label="项目名称" prop="a_name" :show-overflow-tooltip="true" width="150" />
                      <el-table-column label="单位" prop="a_company" :show-overflow-tooltip="true" width="150" />
                      <el-table-column label="单价(元)" prop="a_price" :show-overflow-tooltip="true" width="150" />
                      <el-table-column label="金额(元)" prop="a_money" :show-overflow-tooltip="true" width="150" />
                      <el-table-column label="检查备注" prop="a_beizhu" :show-overflow-tooltip="true" width="150" />
                      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
                        <template slot-scope="scope">
                          <el-button
                            size="mini"
                            type="text"
                            @click="OpenSprescription()"
                            v-hasPermi="['visits:newvisits:delete']"
                          >删除</el-button>
                        </template>
                      </el-table-column>
                      <el-table-column>
                      </el-table-column>
                    </el-table>
                    <el-row>
                      <el-button  type="primary" style="width: 100%"
                                  size="mini"
                                  @click="OpenSprescriptionAB()"
                                  v-hasPermi="['visits:newvisits:saveprescription']">添加检查项</el-button>
                    </el-row>
                  </el-dialog>


                      <el-dialog :title="title" :visible.sync="OpensaveprescriptionA" width="600px" append-to-body>
                        <el-form :model="queryParams" ref="queryFormjc" :inline="true" label-width="68px">
                          <el-form-item label="关键字" prop="keyword">  <!--prop相当于加了一个请求参数--> <!--要传的参数keyword与实体类中的参数必须一致-->
                            <el-input
                              v-model="queryParams.keyword"
                              placeholder="请输入关键字"
                              clearable
                              size="small"
                              style="width: 240px"
                              @keyup.enter.native="OpenSprescriptionABC()"
                            />
<!--                            <button @click="调用方法"></button>this" this.$router.push({path = '路径名',或者 name = '名字，params: {id:id}})   在子组件中使用this.$route.params.id 进行接收值  公共路由-->
                          </el-form-item>
                          <el-form-item>
                            <el-button type="primary" icon="el-icon-search" size="mini" @click="OpenSprescriptionABC">搜索</el-button>
                            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
                          </el-form-item>
                        </el-form>
                    <el-table  :data="his_saveprescription" height="500px" @selection-change="handleSelectionChange">  <!-- 这条相当于把返回的全部数据遍历输出 -->
                      <el-table-column
                        type="selection"
                        width="55">
                      </el-table-column>
                      <el-table-column el- label="项目费用id" prop="a_id" width="120"  />
                      <el-table-column label="项目名称" prop="a_name" :show-overflow-tooltip="true" width="150" />
                      <el-table-column label="关键字" prop="a_keyword" :show-overflow-tooltip="true" width="150" />
                      <el-table-column label="项目单价" prop="a_price" :show-overflow-tooltip="true" width="150" />
                      <el-table-column label="单位" prop="a_company" :show-overflow-tooltip="true" width="150" />
                    </el-table>
                        <el-button  type="primary" style="width: 100%"
                                    size="mini"
                                    @click="OpenSprescriptionABCD()"
                                    v-hasPermi="['visits:newvisits:saveprescription']">添加并关闭</el-button>
                  </el-dialog>



                  <el-dialog :title="title" :visible.sync="OpendrugslistA"  style="width: 1500px;" append-to-body>
                    <el-button
                      size="mini"
                      type="primary"
                      icon="el-icon-plus"
                      @click="newvisitsB()"
                    >确定添加</el-button>
                    <span v-text="'药用处方全额为'+this.allPrice+'元'"></span>
                    <el-table  :data="findDrugslistByID">  <!-- 这条相当于把返回的全部数据遍历输出 -->
                      <el-table-column label="序号" prop="d_id" />
                      <el-table-column label="项目名称" prop="d_name" :show-overflow-tooltip="true" width="150" />
                      <el-table-column label="单位" prop="d_company" :show-overflow-tooltip="true" width="150" />
                      <el-table-column label="单价(元)" prop="d_price" :show-overflow-tooltip="true" width="150" />
                      <el-table-column label="金额(元)" prop="d_money" :show-overflow-tooltip="true" width="150" />
                      <el-table-column label="检查备注" prop="d_beizhu" :show-overflow-tooltip="true" width="150" />
                      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
                        <template slot-scope="scope">
                          <el-button
                            size="mini"
                            type="text"
                            @click="OpenSprescription()"
                            v-hasPermi="['visits:newvisits:delete']"
                          >删除</el-button>
                        </template>
                      </el-table-column>
                      <el-table-column>
                      </el-table-column>
                    </el-table>
                    <el-row>
                      <el-button  type="primary" style="width: 100%"
                                  size="mini"
                                  @click="OpenSprescriptionBC()"
                                  v-hasPermi="['visits:newvisits:drugslist']">添加药用处方</el-button>
                    </el-row>
                  </el-dialog>


                  <el-dialog :title="title" :visible.sync="OpendrugslistAAA" width="600px" append-to-body>
                    <el-form :model="queryParamsyy" ref="queryFormyy" :inline="true" label-width="68px">
                      <el-form-item label="关键字" prop="name">  <!--prop相当于加了一个请求参数-->
                        <el-input
                          v-model="queryParamsyy.name"
                          placeholder="请输入关键字"
                          clearable
                          size="small"
                          style="width: 240px"
                          @keyup.enter.native="OpenSprescriptionABC()"
                        />
                      </el-form-item>
                      <el-form-item>
                        <el-button type="primary" icon="el-icon-search" size="mini" @click="OpenSprescriptionBCD">搜索</el-button>
                        <el-button icon="el-icon-refresh" size="mini" @click="resetQueryyy">重置</el-button>
                      </el-form-item>
                    </el-form>
                    <el-table  :data="his_VisDrugslist" height="500px" @selection-change="handleSelectionChangeyy">  <!-- 这条相当于把返回的全部数据遍历输出 -->
                      <el-table-column
                        type="selection"
                        width="55">
                      </el-table-column>
                      <el-table-column el- label="药品id" prop="d_id" width="120"  />
                      <el-table-column label="药品名称" prop="d_name" :show-overflow-tooltip="true" width="150" />
                      <el-table-column label="库存量" prop="d_stock" :show-overflow-tooltip="true" width="150" />
                      <el-table-column label="单位" prop="d_company" :show-overflow-tooltip="true" width="150" />
                      <el-table-column label="换算量" prop="d_conversionquantity" :show-overflow-tooltip="true" width="150" />
                    </el-table>
                    <el-button  type="primary" style="width: 100%"
                                size="mini"
                                @click="OpenSprescriptionBCDE()"
                                v-hasPermi="['visits:newvisits:drugslist']">添加并关闭</el-button>
                  </el-dialog>

                  <tr>
                    <td>
                      <span class="demonstration">主诉：</span><el-input
                      type="textarea"
                      :rows="2"
                      placeholder="请输入内容"
                      v-model="his_patientbank.sComplaint"
                      style="margin-right: 0px;width: 700px;margin-top:20px;margin-bottom: 10px">
                    </el-input>
                    </td>
                  </tr>




                  <tr>
                    <td>
                      <span class="demonstration">诊断信息：</span><el-input
                      type="textarea"
                      :rows="2"
                      placeholder="请输入内容"
                      v-model="his_patientbank.sDiagnostic"
                      style="margin-right: 0px;width: 670px;margin-top:20px;margin-bottom: 10px">
                    </el-input>
                    </td>
                  </tr>
                  <tr>
                    <td>

                      <span class="demonstration">医生建议：</span><el-input
                      type="textarea"
                      :rows="2"
                      placeholder="请输入内容"
                      v-model="his_patientbank.sAdvice"
                      style="margin-right: 0px;width: 670px;margin-top:20px;margin-bottom: 10px">
                    </el-input>
                    </td>
                  </tr>

                  <tr>
                    <td>
                      <span class="demonstration">备注：</span><el-input
                      type="textarea"
                      :rows="2"
                      placeholder="请输入内容"
                      v-model="his_patientbank.sRemark"
                      style="margin-right: 0px;width: 700px;margin-top:20px;margin-bottom: 10px">
                    </el-input>
                    </td>
                  </tr>
                  </tbody>
                </table>
              </div>
            </el-card>
          </el-tab-pane>
          <el-tab-pane label="处方">    <!--删除都没做-->  <!--总价是错误的  只将添加检查处方的总价返回了   但是如果删除一条数据就不准了-->
<!--            <span v-text="'❌ 如果在任何一个界面删除一条数据就不准了'"></span><br>-->
            <span v-text="'当前检查处方的总价为'+this.allPrice"></span><br>
            <span v-text="'当前药用处方的总价为'+this.allPriceyy"></span>
            <el-table  :data="getxkjzdata">  <!-- 这条相当于把返回的全部数据遍历输出 -->
              <el-table-column label="序号" prop="a_id" />
              <el-table-column label="项目名称" prop="a_name" :show-overflow-tooltip="true" width="150" />
              <el-table-column label="单价(元)" prop="a_price" :show-overflow-tooltip="true" width="150" />
              <el-table-column label="金额(元)" prop="a_money" :show-overflow-tooltip="true" width="150" />
              <el-table-column label="关键词" prop="a_keyword" :show-overflow-tooltip="true" width="150" />
              <el-table-column label="状态" prop="a_status" :show-overflow-tooltip="true" width="150" />
              <el-table-column label="检查备注" prop="a_beizhu" :show-overflow-tooltip="true" width="150" />
              <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
                <template slot-scope="scope">
                  <el-button
                    size="mini"
                    type="text"
                    @click="OpenSprescription()"
                    v-hasPermi="['visits:newvisits:delete']"
                  >删除</el-button>
                </template>
              </el-table-column>
              <el-table-column>
              </el-table-column>
            </el-table>


            <el-table  :data="getxkjzdataB">  <!-- 这条相当于把返回的全部数据遍历输出 -->
              <el-table-column label="序号" prop="d_id" />
              <el-table-column label="药品名称" prop="d_name" :show-overflow-tooltip="true" width="150" />
              <el-table-column label="数量" prop="d_quantity" :show-overflow-tooltip="true" width="150" />
              <el-table-column label="单价(元)" prop="d_price" :show-overflow-tooltip="true" width="150" />
              <el-table-column label="金额(元)" prop="d_money" :show-overflow-tooltip="true" width="150" />
              <el-table-column label="服用备注" prop="d_beizhu" :show-overflow-tooltip="true" width="150" />
              <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
                <template slot-scope="scope">
                  <el-button
                    size="mini"
                    type="text"
                    @click="OpenSprescription()"
                    v-hasPermi="['visits:newvisits:delete']"
                  >删除</el-button>
                </template>
              </el-table-column>
              <el-table-column>
              </el-table-column>
            </el-table>
            <el-row>
              <el-button type="success" round
                         icon="el-icon-plus"
                         @click="OpenSprescription">添加检查处方</el-button>
              <el-button type="success" round
                         icon="el-icon-plus"
                         @click="OpenSDrugslist">添加药用处方</el-button>
            </el-row>

          </el-tab-pane>
        </el-tabs>



      </el-col>
    </el-row>
  </div>
</template>

<script>
    import { getServer,getPatientbank,getPatientbankById,findreg,savepat,OpenSaveprescriptionAA,OpenSaveprescriptionAAA,OpenSaveprescriptionBB,OpenSaveprescriptionBBB,saveAllCasebl,saveAllCasebl2} from "@/api/monitor/server";
export default {
  name: "Server",
  data() {
    return {
      // 加载层信息
      loading: [],
      // 服务器信息
      server: [],
      //打开选择挂号患者弹窗
      prescription:false,

      //接诊类型的字典数据
      jzlxoptions:[],

      //是否感染的字典数据
      sfgroptionssfgroptions:[],

      //存储用户多选的id(检查)
      ids:[],

      //存储用户多选的id(药用)
      idsyy:[],

      //打开添加检查处方弹窗
      Openprescription:false,

      //打开添加药用处方弹窗
      OpendrugslistA:false,

      //打开检查项目弹窗
      OpensaveprescriptionA:false,

      //打开药品列表弹窗
      OpendrugslistAAA:false,

      //检查处方弹窗数据的存储
      saveprescription:[],

      //药用处方弹窗数据的存储
      VisDrugslist:[],

      //检查项目列表数据的存储
      his_saveprescription:[],

      //药用处方列表数据的存储
      his_VisDrugslist:[],

      //选择挂号患者弹窗数据的存储
      his_patientbanks:[],

      //存放用户选择的多个id查询出来的值
      findPrescriptionByID:[],

      //存放用户选择的多个id查询出来的值（药用）
      findDrugslistByID:[],

      //保存总金额(检查)
      allPrice:'',

      //保存总金额(药用)
      allPriceyy:'',

      //点击确定添加将用户选择的多个id查询出来的值赋值给新开就诊页面
      getxkjzdata:[],

      //点击确定添加将用户选择的多个id查询出来的值赋值给新开就诊页面
      getxkjzdataB:[],

      // 检查处方查询参数
      queryParams: {
        keyword:undefined,
      },

      // 药用处方查询参数
      queryParamsyy: {
        name:undefined,
      },

      //存储根据id进行查询所返回的数据
      his_patientbank:
      {
        sId:'',
        sName:'',
        sPhone:'',
        sIdnumber:'',
        sBirth:'',
        sAge:'',
        sSex:'',
        sStatus:'',
        sAddress:'',
        sAllergy:'',
        sDate:'',
        sType:'',
        sIscontagion:'',
        sComplaint:'',
        sDiagnostic:'',
        sAdvice:'',
        sRemark:'',
        sRegistration:''
      },
      //专门放挂号单id和病例编号的数组
      regnum:{
        s_registration_form_id:'',
        s_case_number:''
      },
      exam:{
        textarea:undefined,

      }
    };
  },
  created() {
    this.getList();
    //this.openLoading();
    this.getDicts("sys_registration_type").then(response =>{
      this.jzlxoptions = response.data;
    });
    this.getDicts("sys_yes_no").then(response =>{
      this.sfgroptions = response.data;
    });
  },



  //还需要写下拉框
  methods: {
    // 多选框选中数据  （检查）
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.a_id)
      this.single = selection.length!=1
      this.multiple = !selection.length
    },

    // 多选框选中数据  （药用）
    handleSelectionChangeyy(selection) {
      this.idsyy = selection.map(item => item.d_id)
      this.single = selection.length!=1
      this.multiple = !selection.length
    },
    /** 查询服务器信息 */
    getList() {
      getServer().then(response => {
        this.server = response.data;
        this.loading.close();
      });
    },
    open(){
      //保存所有数据
      getPatientbank().then(response => {
        this.prescription=true;
        this.his_patientbanks = response.data;
      })
    },
    preList(sId){
      getPatientbankById(sId).then(response =>{
        this.his_patientbank.sId = response.data[0].s_id;
        this.his_patientbank.sName = response.data[0].s_name;
        this.his_patientbank.sPhone = response.data[0].s_phone;
        this.his_patientbank.sIdnumber = response.data[0].s_idnumber;
        this.his_patientbank.sBirth = response.data[0].s_birth;
        this.his_patientbank.sAge = response.data[0].s_age;
        this.his_patientbank.sSex = response.data[0].s_sex;
        this.his_patientbank.sStatus = response.data[0].s_status;
        this.his_patientbank.sAddress = response.data[0].s_address;
        this.his_patientbank.sAllergy = response.data[0].s_allergy;
        this.his_patientbank.sDate = response.data[0].s_date;
        this.his_patientbank.sType = response.data[0].s_type;
        this.his_patientbank.sIscontagion = response.data[0].s_iscontagion;
        this.his_patientbank.sComplaint = response.data[0].s_complaint;
        this.his_patientbank.sDiagnostic = response.data[0].s_diagnostic;
        this.his_patientbank.sAdvice = response.data[0].s_advice;
        this.his_patientbank.Remark = response.data[0].remark;
        this.his_patientbank.sRegistration = response.data[0].s_registration;
      })
      savepat(sId).then(response =>{
        alert("点击接诊的添加操作成功")
      })
      findreg(sId).then(response =>{
        this.regnum.s_registration_form_id = response.data.s_registration_form_id;
        this.regnum.s_case_number = response.data.s_case_number;

        //这里应该关闭弹窗
        this.prescription=false;
      })
    },
    //检查处方弹窗的打开
    OpenSprescription(){
      this.Openprescription = true;
    },

    //药用处方弹窗的打开
    OpenSDrugslist(){
      this.OpendrugslistA = true;
    },

    //检查项目列表
    OpenSprescriptionAB(){
      OpenSaveprescriptionAA().then(response =>{
        this.OpensaveprescriptionA = true;
        this.his_saveprescription = response.data;
      })
    },

    //药用处方列表
    OpenSprescriptionBC(){
      OpenSaveprescriptionBB().then(response =>{
        this.OpendrugslistAAA = true;
        this.his_VisDrugslist= response.data;
      })
    },

    //检查项目列表的搜索功能
    OpenSprescriptionABC(){
      OpenSaveprescriptionAA(this.queryParams.keyword).then(response =>{
        this.his_saveprescription = response.data;
      })
    },

    //药用处方列表的搜索功能
    OpenSprescriptionBCD(){
      OpenSaveprescriptionBB(this.queryParamsyy.name).then(response =>{
        this.his_VisDrugslist = response.data;
      })
    },

    //将用户选择的检查处方id传到后台查询数据  之后再遍历到添加检查处方列表中
    OpenSprescriptionABCD(){
      OpenSaveprescriptionAAA(this.ids).then(response =>{
        this.findPrescriptionByID = response.data.rows;
        this.allPrice = response.data.nums;
      })
    },

    //将用户选择的药用处方id传到后台查询数据  之后再遍历到添加药用处方列表中
    OpenSprescriptionBCDE(){
      OpenSaveprescriptionBBB(this.idsyy).then(response =>{
        this.findDrugslistByID = response.data.rows;
        this.allPriceyy = response.data.nums;
        console.log(response.data.rows)
        console.log(this.findDrugslistByID)
      })
    },

    //点击确定添加将用户选择的多个id查询出来的值赋值给新开就诊页面
    newvisits(){
      this.getxkjzdata = this.findPrescriptionByID;
    },

    //点击确定添加将用户选择的多个id查询出来的值赋值给新开就诊页面
    newvisitsB(){
      this.getxkjzdataB = this.findDrugslistByID;
    },

    /** 检查重置按钮操作 */
    resetQuery() {
      this.his_saveprescription = [];
      this.resetForm("queryFormjc");
      this.OpenSprescriptionAB();
    },

    /** 药用重置按钮操作 */
    resetQueryyy() {
      this.his_VisDrugslist = [];
      this.resetForm("queryFormyy");
      this.OpenSprescriptionBC();
    },

    //保存所有病例
      saveAllCase(){
      //传对象  .then(response =>{
      saveAllCasebl(this.his_patientbank).then(response =>{
        if(response.data != 0){
          alert("保存病例表添加成功")
        }
      })
      //传两个int类型的数组
      saveAllCasebl2(this.ids,this.idsyy).then(response =>{
        if(response.data != 0){
          alert("药方和检查表添加成功")
        }
      })
    },

    //刷新页面
    reload(){
      location.reload();
    },
    // 打开加载层
    openLoading() {
      this.loading = this.$loading({
        lock: true,
        text: "读取中",
        spinner: "el-icon-loading",
        background: "rgba(0, 0, 0, 0.7)"
      });
    }
  }
};
</script>
